package 狂神多线程;

import java.util.ArrayList;

public class UnsafeList {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < 10000; i++) {
            new Thread(
                    ()->{
                        list.add(Thread.currentThread().getName());
                    }
            ).start();
            System.out.println(list.size());
        }
    }

}
